#include "MainWindow.h"
MainWindow::MainWindow()
{

	butt = new MyButton();
	butt->setGeometrySize();
	butt->setButmode();
	butt->setButTextCol();
	butt->setButShowPos("123");

	man = new Man();
	chess = new Chess(13, 44, 43, 67.3);
	ai = new AI();
	game = new ChessGame(man, ai, chess);
}
MainWindow::~MainWindow()
{
	if (man != nullptr)
	{
		delete man;
		man = nullptr;
	}
	if (ai != nullptr)
	{
		delete ai;
		ai = nullptr;
	}
	if (chess != nullptr)
	{
		delete chess;
		chess = nullptr;
	}
	if (game != nullptr)
	{
		delete game;
		game = nullptr;
	}
}

void MainWindow::GameRun()
{
	if (game != nullptr)
	{
		game->play();
	}
}
